/**
 * @(#)SourceTreeProgressListener.java, 2008-5-7.
 * Copyright 2008  Program Analysis Research Group(PARG),Institute of Software, Peking University.
 * All rights reserved.
 */
package edu.pku.sei.pgie.analyzer.internal;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;

import edu.pku.sei.pgie.analyzer.core.ISourceTreeVisitorListener;

/**
 *
 * @author HeLi
 *
 */
public class SourceTreeProgressListener extends ISourceTreeVisitorListener {
    IProgressMonitor monitor;

    public SourceTreeProgressListener(IProgressMonitor monitor) {
        this.monitor = monitor;
    }

    public void onVisitSource(IJavaElement javaElement) {
        if (monitor != null) {
            if (javaElement instanceof ICompilationUnit) {
                monitor.setTaskName(javaElement.getResource().getFullPath()
                        .toString());
            }
        }
    }
}